//
//  GiftLunBoCollectionViewCell.m
//  礼物说
//
//  Created by dllo on 16/4/26.
//  Copyright © 2016年 sunzhichao. All rights reserved.
//

#import "GiftLunBoCollectionViewCell.h"

@interface GiftLunBoCollectionViewCell ()

@property (nonatomic, retain) NSMutableArray *urlArrs;

@end

@implementation GiftLunBoCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}
- (void)dealloc {
    [_urlArr release];
    [_urlArrs release];
    [super dealloc];
}

- (void)setUrlArr:(NSMutableArray *)urlArr{
    if (_urlArr != urlArr) {
        [_urlArr release];
        _urlArr = [urlArr retain];
    }
    self.urlArrs = [NSMutableArray arrayWithArray:_urlArr];
    
    [self createCell];
}

- (void)createCell {
    DCPicScrollView * scroll = [DCPicScrollView picScrollViewWithFrame:CGRectMake(0, 0, kWIDTHCELL, kHEIGHTCELL) WithImageUrls:_urlArrs];
    NSLog(@"%@",_urlArrs);
    scroll.currentPageIndicatorTintColor = [UIColor whiteColor];
    scroll.pageIndicatorTintColor = [UIColor grayColor];
    scroll.textColor = [UIColor redColor];
    //图片的点击方法， 能获取到index
    [scroll setImageViewDidTapAtIndex:^(NSInteger index) {
        NSLog(@"%ld", index);
    }];
    
    //轮播时间， 时间小于.5时，将不自动轮播
    scroll.AutoScrollDelay = 3;
    
    //添加
    [self.contentView addSubview:scroll];

    //请求失败请求几次
    [[DCWebImageManager shareManager] setDownloadImageRepeatCount:1];
    
    //打印错误信息
    [[DCWebImageManager shareManager] setDownLoadImageError:^(NSError * error, NSString * str) {
        
        NSLog(@"%@",error);
    }];

}

@end
